// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
// import com.alibaba.druid.sql.ast.statement.SQLSelect;
// import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlStatementImpl;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

#include "MySqlCursorDeclareStatement.h"
#include "../../../../ast/SQLName.h"
#include "../../../../ast/expr/SQLIdentifierExpr.h"
#include "../../../../ast/statement/SQLSelect.h"
#include "../../visitor/MySqlASTVisitor.h"

SQLName_ptr MySqlCursorDeclareStatement::getCursorName()
{
  return cursorName;
}

void MySqlCursorDeclareStatement::setCursorName(SQLName_ptr cursorName)
{
  if (cursorName != nullptr)
  {
    cursorName->setParent(SharedObject(MySqlCursorDeclareStatement));
  }
  this->cursorName = cursorName;
}

void MySqlCursorDeclareStatement::setCursorName(string_ptr cursorName)
{
  this->setCursorName(SQLIdentifierExpr_ptr(new SQLIdentifierExpr(cursorName)));
}

SQLSelect_ptr MySqlCursorDeclareStatement::getSelect()
{
  return select;
}

void MySqlCursorDeclareStatement::setSelect(SQLSelect_ptr select)
{
  if (select != nullptr)
  {
    select->setParent(SharedObject(MySqlCursorDeclareStatement));
  }
  this->select = select;
}

// @Override
void MySqlCursorDeclareStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlCursorDeclareStatement)))
  {
    acceptChild(visitor, select);
  }
  visitor->endVisit(SharedObject(MySqlCursorDeclareStatement));
}
